<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../css/bootstrap.min.css" />
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/DatePicker.js"></script>
<title>商品添加页面</title>
<%--	<script type="text/javascript">
		//连接servlet 获取 数据
		function loadType(){
			$.ajax({
				url:"${pageContext.request.contextPath}/admin/type?method=getGoodType",
				dataType: 'json',
				method:"get",
				success:function(data){
					showMsg(data);
				},
				error:function(XMLHttpRequest,textStatus,errorThrown){
					alert("失败"+XMLHttpRequest.status+":"+textStatus+":"+errorThrown);
				}
			});
		}

		//显示商品分类信息
		function showMsg(typeList){
			for (var type in typeList){
			var t = $('<option value="${type.tid }">${type.tname }</option>');
				$("#goodsParent").append(t);
			}
		}

		//页面加载即调用函数
		$(function () {
			loadType()
		});
	</script>--%>
</head>
<body>
	<div class="row" style="margin-left: 20px;">
		<form action="${pageContext.request.contextPath }/admin/product?method=addGoods" method="post" enctype="multipart/form-data">
			<div>
				<h3>新增商品</h3>
			</div>
			<hr />
			<div class="row">
				<div class="col-sm-6">
					<div class="form-group form-inline">
						<label>名称:</label>
						<input type="text" name="pname" class="form-control" />
					</div>
					
					<div class="form-group form-inline">
						<label>分类:</label>
						<%--<select name="typeid" class="form-control">
							<option value="0">------</option>
							<option value="1">电脑</option>
							<option value="2">笔记本</option>
							<option value="3">平板</option>
							<option value="7">小米手机</option>
							<option value="8">红米</option>
						</select>--%>
						<select name="goodsParent">
							<option value="1">--请选择--</option>
							<c:forEach items="${TypeList }" var="type">
								<%--<c:if test="${type.level <=2}">
									<option value="${type.tid }">${type.tname }</option>
								</c:if>--%>
								<option value="${type.tid }">${type.tname }</option>
							</c:forEach>
						</select>
					</div>
					<div class="form-group form-inline">
						<label>时间:</label>
						<input type="text" name="ptime" readonly="readonly" class="form-control" onclick="setday(this)" />
					</div>
				</div>
				<div class="col-sm-6">
					<div class="form-group form-inline">
						<label>价格:</label>
						<input type="text" name="pprice" class="form-control" />
					</div>
					<div class="form-group form-inline">
						<label>评分:</label>
						<input type="text" name="pstate" class="form-control" />
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-sm-10">
					<div class="form-group form-inline">
						<label>商品图片</label>
						<input type="file" name="pimage" />
					</div>
					<div class="form-group ">
						<label>商品简介</label>
						<textarea  name="pinfo" class="form-control" rows="5"></textarea>
					</div>
					<div class="form-group form-inline">
						<input type="submit" value="添加" class="btn btn-primary" />
						<input type="reset" value="重置" class="btn btn-default" />
					</div>
				</div>
			</div>
		</form>
	</div>
</body>
</html>